/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pop3proxy;

import java.util.concurrent.Semaphore;
import pop3proxy.client.Client;
import pop3proxy.persistence.Mailbox;
import pop3proxy.server.TCPServer;

public class Launcher {
    public static void main(String... args) throws InterruptedException {
        Semaphore quit = new Semaphore(0);
        
        Mailbox mailbox = Mailbox.file;
        Client client = new Client(mailbox, quit);
        TCPServer server = new TCPServer(mailbox);
        
        client.start();
        server.start();
        
        try {
            quit.acquire();  //Blockieren, bis Programm beendet werden soll
        } catch (InterruptedException ex) {} //Verwerfen, da Programm nun eh geschlossen wird
        
        //Alle erzeugten Threads beenden
        client.interrupt();
        server.interrupt();
    }
}
